<!doctype html>
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/mobile/include/include.jsp"%>
<html lang="cn">
<head>
<%@ include file="/jsp/mobile/include/header.jsp"%>
<title>密码找回</title>
</head>
<body class="nobg">
	<!-- <div class="head">
		<div class="auto">
			<span class="tit">温馨提醒</span> <a href="###" class="ico retu"></a>
		</div>
	</div> -->
	<form id="getpassword" action="<%=request.getContextPath()%>/mobile/index/getpwdsecond">
	<div class="main">
		<div class="sinfo">
			<div class="sfb">
				<i class="ico ico32"></i> <input id="telephone" name="telephone"
					type="tel" class="text" placeholder="请输入手机号码">
			</div>
			<div class="sfb sfb2">
				<i class="ico ico33"></i> <input id="verifyCode" name="verifyCode"
					type="tel" class="text" placeholder="请输入验证码"> <a id="sendVerifyCode"
					href="javascript:sendVerifyCode();" class="yzm">获取验证码</a>
			</div>
		</div>
		<div class="payOk">
			<div class="nbtn mt20">
				<a class="butn" href="javascript:next();">下一步</a>
			</div>

		</div>
	</div>
	</form>
	<script type="text/javascript">
	var wait = 60; 
	function verifyCodeTime() {
        var _obj = $("#sendVerifyCode");
        if (wait == 0) {
            $(_obj).attr("href", "javascript:sendVerifyCode();");
            $(_obj).html("获取验证码");
            wait = 60;
        } else {
            $(_obj).removeAttr("href");
            $(_obj).html(wait + "秒后获取");
            wait--;
            setTimeout(function() {
                        verifyCodeTime();
                    },
                    1000);
        }
    }
	function next() {
        var _verifyCode = $("#verifyCode").val();
        if (_verifyCode == '') {
            window.openMsg("输入验证码", 3);
        } else {
            $("#getpassword").submit();
        }
    }
    function sendVerifyCode() {
    	var _telephone = $("#telephone").val().trim();
    	var _msg = "";
    	if (_telephone == '') {
            _msg += "输入银行预留手机号\r\n";
        }else if(!$.phone(_telephone))
        {
        	_msg += "输入手机号不正确\r\n";
        }
    	if (_msg == "") {
        $.ajax({
            type: "GET",
            url: "<%=request.getContextPath()%>/mobile/index/getPwdVerifyCode",
							data : {
								'telephone' : _telephone 
							},
							dataType : "json",
							success : function(msg) {
								if (msg.returnCode == "0000") {
									verifyCodeTime();
									window.openMsg("短信已发送", 3);
								} else {
									window.openMsg("短信发送失败", 3);
								}
							}
						});
			} else {
				window.openMsg(_msg, 3);
			}
		}
	</script>
</body>
</html>